package com.design.patterns;

interface Sender3{
    void sender();
}

class MailSender3 implements Sender3{
    public void sender(){
        System.out.println("this is mail sender....");
    }
}

class SmsSender3 implements Sender3{

    public void sender(){
        System.out.println("this is sms sender...");
    }
}

interface Provider{
    Sender3 Produce();
}

class SendMailFactory implements Provider {

    public Sender3 Produce() {
        return new MailSender3();
    }
}

class SendSmsFactory implements Provider {

    public Sender3 Produce() {
        return new SmsSender3();
    }
}

//抽象工厂模式
public class FactoryPattern3 {
    public static void main(String[] args) {
        SendSmsFactory smsFactory = new SendSmsFactory();
        Sender3 s= smsFactory.Produce();
        s.sender();
    }
}
